<!DOCTYPE html>  
<html>  
<head>  
	<meta charset="utf-8"/>
	<title>消息队列</title>  
	<style type="text/css">  
	body{margin:0;padding:0;}  
	#wrap{width:300px;height:200px;border:1px solid #FFFFCC;background-color:#CCFFFF;position:absolute;}  
	#moveHere{cursor: move;width:300px;height: 30px;text-align: center;line-height:30px;background-color:#FFCCCC;}
	 
	</style>
</head>
<body>
<div id="wrap"></div>

<script src='javascripts/jquery.js' type='text/javascript'></script>
<script src='javascripts/F.js' type='text/javascript'></script>
<script type="text/javascript">

<!-- function sayHi() { -->
  <!-- console.log('Hello-->' + (new Date()).getTime()); -->
<!-- } -->

<!-- function A() { -->
  <!-- console.log('A-->' + (new Date()).getTime()); -->
<!-- } -->

<!-- function interval() { -->
  <!-- console.log('setInterval--》' + (new Date()).getTime()); -->
<!-- } -->

<!-- function cycle() { -->
  <!-- while(1){} -->
<!-- } -->

//============ 代码1 ============//

/**
setTimeout(sayHi, 1000);

console.log('主线程代码');

setInterval(interval, 2000);
**/

//============ 代码2 ============//

<!-- setTimeout(sayHi, 1000); -->
<!-- //setTimeout(cycle, 0); -->
<!-- setInterval(interval, 2000); -->



//============ 代码3 ============//
/**
console.log(1);
setTimeout(function(){
     console.log(2);
},2000)
console.log(3);
setTimeout(function(){
     console.log(4);
},1000)
console.log(5);
**/


//============ 代码4 ============//
/**
console.log('时间戳===>' + (new Date()).getTime());
for(var i=0;i<4;i++){
    setTimeout(function(){
       console.log(i + '===>' + (new Date()).getTime());
  },1000);
}
**/


//============ 代码5 ============//
 /**
setTimeout(function(){
   console.log('1')
});

new Promise(function(resolve){
   console.log('2');
   //创建对象：主线程
   
   resolve();
}).then(function(){
   console.log('3')
});

console.log('4');
 **/
//============ 代码6 ============//
 


</script>  
</body>  
</html>  